"""
将微信的退款记录放到系统的退款记录里
"""
import os
import sys
import django

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.extend([BASE_DIR, ])
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "finance_c2c.settings")
django.setup()
from core.wchat.models import RefundRecord as WxRefundRecord
from apps.supply_order.models import RefundRecord


def copy_data_to_new_record():
    insert_list = []
    for i in WxRefundRecord.objects.all():
        obj = RefundRecord(id=i.id, refund_fee=i.refund_fee, create_time=i.create_time, refund_type=1,
                           out_refund_no=i.out_refund_no)
        insert_list.append(obj)
    RefundRecord.objects.bulk_create(insert_list)


if __name__ == '__main__':
    copy_data_to_new_record()
